<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@include file="../../pages/common/taglibs.jsp"%>

<html>
<head>
<title>iot平台管理系统</title>
<script src="js/jquery.min.js"></script>
<script src="js/jquery.form.js"></script>
<script src="js/jquery.easyui.min.js"></script>
<script src="js/echarts.min.js"></script>
<link href="js/themes/bootstrap/easyui.css" rel="stylesheet"/>
<link href="js/themes/icon.css" rel="stylesheet" />
<script src="js/locale/easyui-lang-zh_CN.js"></script>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<meta name="renderer" content="webkit">
<script src="js/common.js"></script>
<script src="js/DateConvertUtil.js"></script>
<link href="css/page.css" rel="stylesheet"/>
<link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css" media="screen" charset="utf-8" />
<script src="js/jquery.validationEngine-en.js" type="text/javascript"></script>
<script src="js/jquery.validationEngine.js" type="text/javascript"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=896d80fa40853d23743c8a6300b0578c"></script>
<script src="js/report.js"></script>
<script src="js/ajaxfileupload.js"></script>
<script src="js/checkCardIDUtil.js"></script>
<script type="text/javascript">
var menuUrl="rest/menuTree.do";

/* online */
//var basePath = "http://101.201.100.203:81";//图片服务器路径

/* test */ 
var basePath = "http://47.95.201.243:80";//图片服务器路径

$(document).ready(function () {
    var html = "";
	$.ajax({
		type : "post",
		url : menuUrl,
		async : false,
		success : function(result) {
			if (result) {
				for(var i=0; i<result.length; i++){
					var p_html_b = "<li>";
					var pmenu = '<div class="link">'+result[i].text+'</div>';
					var p_html_e = "</li>";
										
					var p_sub = result[i].children;
					var sub_html_b='<ul class="submenu">';
					var sub_html_e='</ul>';
					if(p_sub!='undefined' && p_sub!=null && p_sub.length>0){
						for(var j=0; j<p_sub.length; j++){
							if(p_sub[j].attributes!="undefined"){
								console.log(p_sub[j].text);
								var sub_menu = '<li><a href="#" onclick="showCenterIndex(\''+p_sub[j].attributes.url+'\',this)">'+p_sub[j].text+'</a></li>';
								sub_html_b = sub_html_b + sub_menu;
							}
						}
						sub_html_b = sub_html_b + sub_html_e;
					}else{
						sub_html_b = '';
					}
					p_html_b = p_html_b + pmenu + sub_html_b + p_html_e;
					html = html + p_html_b;
				}
				$("#accordion").html(html);
			}
		}
	});

	todo();
})//end ready

//待办事项页面
function todo() {
// 	var url = "todo/index.do";
// 	$.get(url, {}, function(data) {
// 		$("#center").empty();
// 		$("#center").html(data);
// 		$.parser.parse($("#center"));
// 	});
}

$(function () {
    var Accordion = function (el, multiple) {
        this.el = el || {};
        this.multiple = multiple || false;
        var links = this.el.find('.link');
        links.on('click', {
            el: this.el,
            multiple: this.multiple
        }, this.dropdown);
    };
    Accordion.prototype.dropdown = function (e) {
        var $el = e.data.el;
        $this = $(this), $next = $this.next();
        $next.slideToggle();
        $this.parent().toggleClass('open');
        if (!e.data.multiple) {
            $el.find('.submenu').not($next).slideUp().parent().removeClass('open');
        }
        ;
    };
    var accordion = new Accordion($('#accordion'), false);
});
function expandMenu(node){
	$("#menu").tree("toggle",node.target);
}
function noword(){
	$('.formtoolbar i').eq(4).before("<p class='rus'></p>");
}
function showCenterIndex(url,t) {
	
	var t = $(t);
	t.parents().find('a').removeClass('active');
	t.addClass('active');
    $.ajax({
	url:url, 
	type:"get",
    beforeSend:function(XMLHttpRequest) {
         $("#center").html("<div class='loading'>页面加载中</div>");
     },
    success:function(data) {
        $("#center").empty();
        $("#center").html(data);
        $.parser.parse($("#center"));
        noword();
    }
    });
}
function newPasswd(){
  var url = "user/editPasswd.do";
    $.post(url,{},
    function(data) {
        $("#center").empty(); 
        $("#center").html(data);
        $.parser.parse($("#center"));
    });
}

</script>
</head>


<body>

		<div id="header">
			<div class="logo">xxx
  			</div>
  			<div class="navright">
				欢迎您!<span><shiro:principal />
						<shiro:user />
					</span>
<!-- 					<a href="#" class="top_rt_bz" onclick="todo()">待办事项</a> -->
					<a href="#" class="top_rt_xgmm" onclick="newPasswd()">
						修改密码
					</a>
					<a href="logout">
						退出
					</a>
				</div>
		</div>
		<!-- 左部菜单 -->
	
			<div id="menu" >
				<div class="abcd">
					<ul id="accordion" class="accordion"></ul>
				</div>
			</div>
		
		<!--中部工作区  -->
		<div id="center">
			
		</div>
		<!-- <div id="south" split="true" region="south" title="" style="padding:5px;text-align:center;">
			Copyright 2017-2019  智慧校车有限责任公司
		</div> -->



</body>
</html>